{include file="Public/header" /}
<style>
    html,body{
        background: #fff;
    }
    .panel{
        border: none;
    }
    .am-dropdown{
        width: 100%;
        padding-left: 30px;
        margin-bottom: 10px;
    }
    .am-dropdown div{
        color: #000;
    }
</style>
<div class="panel admin-panel" style="background: #fff;">
    <br>
    <script>
        //city canshu
        var pid='{:input("get.pid")}';
        var cid='{:input("get.cid")}';
        var aid='{:input("get.aid")}';
        var selectc=true;
        var selecta=true;
        function select_p() {
            return false;
        }
        function select_c() {
            return false;
        }
        function select_a(){
            location.href="?pid="+pid+"&cid="+cid+"&aid="+aid;
        }
    </script>
    <div class="am-dropdown">
        <div class="label">
            <label for="name">{:lang('currency')['city']}</label>
        </div>
        <div class="field">
            {include file="public/city" /}
        </div>
    </div>
    {if {:input("get.aid")}
    <form id="register_form">
        <div class="am-dropdown">
            <div class="label">邀请注册送优惠</div>
            <div class="field">
                <select name="did" class="input input-auto">
                    {foreach $discount_arr as $k => $v}
                        {php}
                        if($v['type'] == 'discount')$type='优惠券';
                        if($v['type'] == 'cash')$type='代金券';
                        if($v['type'] == 'reduced')$type='打折券';
                        {/php}
                    <option value="{$v.id}" {if $register.did == $v.id}selected{/if}>{$type}{$v.full}减{$v.minus}</option>
                    {/foreach}
                </select>
            </div>
        </div>
        <div class="am-dropdown">
            <div class="label">有效期</div>
            <div class="field">
                <input type="number" class="input input-auto" min="0" style="width: 80px" name="indate" value="{$register.indate}"> 天
            </div>
        </div>
        <div class="am-dropdown">
            <div class="label">状态</div>
            <div class="field">
                <label class="button button-small {if $register.on_off == 1}active{/if}">
                    <input name="on_off" value="1" {if $register.on_off == 1}checked="checked"{/if} type="radio">是
                </label>
                <label class="button button-small {if $register.on_off == 0 || !$register.on_off}active{/if}">
                    <input name="on_off" value="0" {if $register.on_off == 0 || !$register.on_off}checked="checked"{/if} type="radio">否
                </label>
            </div>
        </div>
        <div class="am-dropdown">
            <input type="button" value="保存" class="button" onclick="save_register()">
        </div>
    </form>
    {else}
    　　请选择名称后设置
    {/if}
</div>
<script>
    function save_register() {
        var data = $("#register_form").serialize();
        $.ajax('__URL__/set?title=register&aid='+aid,{
            type:"POST",
            data:data,
            success:function () {
                location.reload();
            }
        })
    }
</script>
{include file="Main/menu_footer" /}